Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Address 24.2 EMPD Issue #10781

Merged
merged 1 commit into from
Oct 3, 2024
Merged

Address 24.2 EMPD Issue #10781

merged 1 commit into from
Oct 3, 2024

Conversation

Myoldmopar
Copy link
Member

Pull request overview

Most of the conversation can be found here, but basically, there was an incorrect check that let an invalid configuration pass before 24.2, accidentally segfaulted in 24.2.0, and now fails gracefully (in 24.2.1+).

I don't expect any diffs or failures, so if there are any, this won't be ready. If it's all green, I think it's good to go.

@Myoldmopar Myoldmopar added the Defect Includes code to repair a defect in EnergyPlus label Oct 3, 2024
@Myoldmopar Myoldmopar added this to the EnergyPlus 24.2 milestone Oct 3, 2024
@Myoldmopar Myoldmopar self-assigned this Oct 3, 2024
Copy link
Member Author

@Myoldmopar Myoldmopar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If CI is clean, this should be fine to drop in and we can start getting 24.2.1 out.

@@ -249,9 +249,9 @@ void GetMoistureBalanceEMPDInput(EnergyPlusData &state)

auto const &constr = state.dataConstruction->Construct(surf.Construction);
auto const *mat = dynamic_cast<const MaterialEMPD *>(s_mat->materials(constr.LayerPoint(constr.TotLayers)));
assert(mat != nullptr);
// assert(mat != nullptr);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The way things are structured now, it's totally fine for this to result in a nullptr. If the material doesn't have any EMPD properties, that's fine. So we shouldn't do a hard assertion.


if (mat->mu > 0.0 && surf.Zone > 0) {
if (mat && mat->mu > 0.0 && surf.Zone > 0) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead, let's just check that mat is real before accessing it. This will properly pass if the inside layer has EMPD stuff. And it will properly result in a warning message if the layer does not have EMPD stuff. This works happily now.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just curious, why not not the hasEMPD boolean? isn't what it's for?

@Myoldmopar
Copy link
Member Author

@jmarrec if you update your test to handle this graceful failure, let me know how it goes.

@amirroth your code indeed causes the test to fail now. As it should have all along! So thanks for that. I'm happy to handle any comments you have on my changes here.

@Myoldmopar
Copy link
Member Author

Everything is happy here. OK, merging this and tagging v24.2.1-RC1.

Sorry about this, and thanks for reporting it, @jmarrec

@Myoldmopar Myoldmopar merged commit 94a8878 into develop Oct 3, 2024
11 checks passed
@Myoldmopar Myoldmopar deleted the FixEMPD branch October 3, 2024 17:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Defect Includes code to repair a defect in EnergyPlus
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Segfault with MoisturePenetrationDepth
6 participants